import React, { useEffect,useRef,useState } from 'react'
import { Button } from 'antd';
export default function Test() {
    let [ary,setAry] = useState([]);
    let [count,setCount] = useState(0);
    let inputRef = useRef(null);
    useEffect(() => {
        console.log('effect');
        return () => {
            console.log("clean");
        }
    },[count]);
    useEffect(() => {
        console.log('effect1');
    })
    const handleClick = () => {
        console.log(inputRef.current.value);
        // ary.push(Math.random());
        // setAry([...ary]);
        // console.log("ary",ary);
        // setCount(1);
    }
    console.log("render");
    return (
       
        <div>
            <div>
                count:{count}
            </div>
            <ul>
                {ary.map((ele) => <li key={ele}>{ele}</li>)}
            </ul>
            <Button type="primary">确定</Button>
            <input type="text" ref={inputRef} />
            <input type="button" value="ok" onClick={handleClick} />
        </div>
    )
}
